package com.epfresh.api.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

/**
 * @author wangzhanghuan
 * @version 1.0
 * @date create 17-2-21
 * @Description
 */

public class CommonUtils {

    public static void intoPhone(Context context, String phone) {
        if (context == null)
            return;
        Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phone));//调出来拨打页面；
        context.startActivity(intent);
    }


    /**
     * 设置沉浸式状态栏
     * 大于等于5.0
     * @param activity
     */
    public static void setImmersiveStatusBar(Activity activity) {
//        activity.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = activity.getWindow();
//            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE );
//            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.TRANSPARENT);
        }
    }



}
